var http = require('http')

// 发送一个请求
var options = {
  port: 10000,
  hostname: '127.0.0.1',
  headers: {
    'Connection': 'Upgrade',
    'Upgrade': 'websocket'
  }
};

var req = http.request(options);

req.on('upgrade', (res, socket, upgradeHead) => {
  console.log(res, socket, upgradeHead);
});